/**
 * Copyright 2025 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */

:host {
    --spectrum-modal-confirm-entry-animation-duration: var(--mod-modal-confirm-entry-animation-duration, var(--spectrum-animation-duration-500));
    --spectrum-modal-confirm-entry-animation-delay: var(--mod-overlay-animation-duration-opened, var(--mod-modal-confirm-entry-animation-delay, var(--spectrum-animation-duration-200)));
    --spectrum-modal-confirm-exit-animation-duration: var(--mod-overlay-animation-duration, var(--mod-modal-confirm-exit-animation-duration, var(--spectrum-animation-duration-100)));
    --spectrum-modal-confirm-exit-animation-delay: var(--mod-modal-confirm-exit-animation-delay, var(--spectrum-animation-duration-0));
    --spectrum-modal-fullscreen-margin: var(--mod-modal-fullscreen-margin, 32px);
}

.modal {
    visibility: hidden;
    opacity: 0;
    transform: translateY(var(--mod-modal-confirm-entry-animation-distance, var(--spectrum-dialog-confirm-entry-animation-distance)));
    z-index: 1;
    max-block-size: 90vh;
    max-block-size: var(--mod-modal-max-height, 90vh);
    max-inline-size: 90%;
    max-inline-size: var(--mod-modal-max-width, 90%);
    background: var(--mod-modal-background-color, var(--spectrum-modal-background-color));
    border-radius: var(--mod-modal-confirm-border-radius, var(--spectrum-corner-radius-100));
    pointer-events: auto;
    transition:
        opacity var(--spectrum-modal-confirm-exit-animation-duration) var(--spectrum-animation-ease-in) var(--spectrum-modal-confirm-exit-animation-delay),
        visibility var(--spectrum-animation-duration-0) var(--spectrum-animation-linear) calc(var(--spectrum-modal-confirm-exit-animation-delay) + var(--spectrum-modal-confirm-exit-animation-duration)),
        transform var(--spectrum-animation-duration-0) var(--spectrum-animation-linear) calc(var(--spectrum-modal-confirm-exit-animation-delay) + var(--spectrum-modal-confirm-exit-animation-duration));
    outline: none;
    overflow: hidden;
}

:host([open]) .modal {
    pointer-events: auto;
    visibility: visible;
    opacity: 1;
    transition:
        transform var(--spectrum-modal-confirm-entry-animation-duration) var(--spectrum-animation-ease-out) var(--spectrum-modal-confirm-entry-animation-delay),
        opacity var(--spectrum-modal-confirm-entry-animation-duration) var(--spectrum-animation-ease-out) var(--spectrum-modal-confirm-entry-animation-delay);
    transform: translateY(0);
}

@media only screen and (device-height <= 350px), only screen and (device-width <= 400px) {
    :host([responsive]) .modal {
        inline-size: 100%;
        block-size: 100%;
        max-inline-size: 100%;
        max-block-size: 100%;
        border-radius: 0;
    }
}

.fullscreen {
    max-inline-size: none;
    max-block-size: none;
    position: fixed;
    inset-block-start: var(--spectrum-modal-fullscreen-margin);
    inset-block-end: var(--spectrum-modal-fullscreen-margin);
    inset-inline-start: var(--spectrum-modal-fullscreen-margin);
    inset-inline-end: var(--spectrum-modal-fullscreen-margin);
}

.fullscreenTakeover {
    max-inline-size: none;
    max-block-size: none;
    box-sizing: border-box;
    border: none;
    border-radius: 0;
    position: fixed;
    inset: 0;
}

.fullscreenTakeover,
:host([open]) .fullscreenTakeover {
    transform: none;
}
